<extend name="Base/common" />
<block name="header">
<header>
  <div class="container text-center">
    <h2>修改密码</h2>
  </div>
</header>
</block>

<block name="body">

<section>
	<div class="row col-md-5 center-block">
    
    <div class="col-md-12">
        <form id="resetpassword-form" class="form-horizontal" action="__SELF__" method="post">
          <div class="form-group">
            <label class="form-label" for="inputPassword">原密码</label>
            <div class="controls">
              <input type="password" id="inputPassword"  class="form-control input-lg" placeholder="请输入密码"  errormsg="密码为6-20位" nullmsg="请填写密码" datatype="*6-20" name="old">
            </div>
          </div>
          <div class="form-group">
            <label class="form-label" for="inputPassword">新密码</label>
            <div class="controls">
              <input type="password" id="inputPassword"  class="form-control input-lg" placeholder="请输入密码"  errormsg="密码为6-20位" nullmsg="请填写密码" datatype="*6-20" name="password">
            </div>
          </div>
          <div class="form-group">
            <label class="form-label" for="inputPassword">确认密码</label>
            <div class="controls">
              <input type="password" id="inputPassword" class="form-control input-lg" placeholder="请再次输入密码" recheck="password" errormsg="您两次输入的密码不一致" nullmsg="请填确认密码" datatype="*" name="repassword">
            </div>
            
          </div>
          
          <div class="form-group">
              <button type="submit" class="btn btn-danger btn-lg col-md-3 col-xs-12">提 交</button>
          </div>
        </form>
        </div>
        
	</div>
</section>
</block>

<block name="side"></block>
<block name="script">
	<script type="text/javascript">

    	$(document)
	    	.ajaxStart(function(){
	    		$("button:submit").attr("disabled", true);
	    	})
	    	.ajaxStop(function(){
	    		$("button:submit").attr("disabled", false);
	    	});

    	$("#resetpassword-form").submit(function(){
    		var self = $(this);
    		$.post(self.attr("action"), self.serialize(), success, "json");
    		return false;

    		function success(data){
    			if(data.status){
					$.zui.messager.success('密码修改成功',{placement:'center'});
    				setTimeout(function(){window.location.href = data.url;},1000);
    			} else {
					$.zui.messager.danger(data.info,{placement:'center'});
    			}
    		}
    	});
	</script>
</block>
